<template>
  <div>
    用户名：<input type="text" v-model="username">
    密码：<input type="password" v-model="password">

    <button @click="gai">修改</button>
  </div>

</template>

<script>
    export default {
        name: "update",
      data(){
          return{
            username:'',
            password:'',
            id:'',

          }
      },
      methods:{
          gai(){
                this.axios({
                    url:'http://127.0.0.1:8000/update/',
                    method:'post',
                    data:{
                        id:this.$route.params.id,
                        username: this.username,
                        password:this.password,
                    }
                }).then(res=>{
                  if (res.data.code==200){
                    alert('修改成功');
                  }else {
                    alert('修改失败');
                  }

                    console.log(this.id);
                    console.log(res);

                })
          }
      }
    }
</script>

<style scoped>

</style>
